# 异常的学习
"""
try:
    year = int(input('请输入年份：'))
except ValueError:
    print('年份要输入数字！')
"""

try:
    f = open('name.txt')
except Exception as e:
    print(e)
finally:
    f.close()

# 自定义错误信息
try:
    raise NameError('helloError')
except NameError:
    print('my custom error')
